package com.vipbbo.spring.transaction;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;

public class AccountByXMLServiceImpl implements AccountByXMLService{


	public void setJdbcTemplate(JdbcTemplate jdbcTemplate) {
		this.jdbcTemplate = jdbcTemplate;
	}

	private JdbcTemplate jdbcTemplate;

	private static String insertSql = "insert into account(balance) values (100)";

	@Override
	public void save() throws RuntimeException {
		System.out.println("======开始执行sql======");
		jdbcTemplate.execute(insertSql);
		System.out.println("======sql执行结束======");
		System.out.println("======准备抛出异常======");
		throw new RuntimeException("手动抛出异常");
	}
}
